import React, { Component } from "react";
import axios from "axios";

//Proxy 代理
export default class Proxy extends Component {
    render() {
        return (
            <div style={{ padding: "30px" }}>
                <button onClick={this.getStudents}>获取所有学员信息</button>
                <button onClick={this.getCars1}>获取所有汽车信息 - 1</button>
                <button onClick={this.getCars2}>获取所有汽车信息 - 2</button>
            </div>
        );
    }

    getStudents = async () => {
        let result = await axios("/api1/students");
        console.log(result);
    };

    getCars1 = async () => {
        // 5000 
        let result = await axios("/api1/cars");
        console.log(result);
    };

    getCars2 = async () => {
        // 5001
        let result = await axios("/api2/cars");
        console.log(result);
    };
}
